package com.zhongnan.demo8;

import java.util.concurrent.atomic.AtomicInteger;

public class MyThreadCode implements Runnable{
//    private int count = 0;
//    private Object lock = new Object();
    AtomicInteger ac = new AtomicInteger(0);
    @Override
    public void run() {

        for (int i = 0; i < 100; i++) {
//            synchronized (lock) {
//                count++;
            int count = ac.incrementAndGet();
                System.out.println(count);
//            }
        }
    }
}
